package com.by.shop.user.service;

import com.alibaba.fastjson.JSON;
import com.by.shop.common.entity.Order;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RocketMQMessageListener(consumerGroup = "shop-user", topic = "zhule")
public class SmsService implements RocketMQListener<Order> {
    @Override
    public void onMessage(Order order) {
        /*System.out.println(order);*/
        try {
            // 删除的代码
            log.info("收到一个订单信息{},接下来发送短信", JSON.toJSONString(order));
        } catch (Exception e) {
            log.error("处理订单消息出错: {}", e.getMessage());
            throw e;
        }
    }
}
